package com.back.campus_back.controller;


import com.back.campus_back.domain.GoodsCategory;
import com.back.campus_back.service.GoodsCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-04-17
 */
@RestController
@RequestMapping("/goods-category")
@Api(tags = "商品分类的控制类")
public class GoodsCategoryController {

    @Autowired
    private GoodsCategoryService goodsCategoryService;

    @GetMapping("/type")
    @ApiOperation("更新商品类型")
    public void changeType(@RequestParam("categoryName")String categoryName,@RequestParam("id") Integer id){
         goodsCategoryService.updateByType1(categoryName,id);
    }

    //查询商品类型
    @ApiOperation("查询全部商品类型")
    @GetMapping("/findAllCategory")
    public List<GoodsCategory> findAllCategory(){
        return goodsCategoryService.findAllCategory();
    }

}

